lib=libmyStdio.so

$(lib):myStdio.o
	@gcc $^ -shared -o $@ #gcc在生成动态库时，会自动进行打包

myStdio.o:myStdio.c
	@gcc -c -fPIC -std=c99 $^ #在生成.o文件时，生成地址无关码(fPIC)

.PHONY:clean
clean:
	@rm -rf *.o *.so

.PHONY:output
output:
	@mkdir -p lib/include
	@mkdir -p lib/libmyStdio
	@cp *.h lib/include
	@cp *so lib/libmyStdio
